/**
 * 
 * 广州锐鹏计算机科技有限公司（www.ruipengkj.com）
 * 
 * 
 * Copyright (c) 2011-2012 RUIPENGKJ.Co.Ltd. All rights reserved.
 * 
 * */
package com.ruipengkj.component;

import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;

import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

import com.ruipengkj.factory.ImageFactory;
/**
 * 说明：
 * 文本+输入框
 * @Author：李智深
 * @Date：2012-03-14
 */
public class JLabelJTextFieldComponent extends JPanel{
	
	private static final long serialVersionUID = 1L;
	private RPJTextField text;
	private Dimension dimension=null;
	private ImageIcon icon=ImageFactory.loadImage(ImageFactory.ICON_4);
	public JLabelJTextFieldComponent(String lable,int width){
		this.setLayout(new FlowLayout(FlowLayout.LEFT));
		this.setOpaque(false);
		dimension=new Dimension(width, 25);
		JLabel label=new JLabel(lable,icon,JLabel.LEFT);
		text=new RPJTextField(width);
		text.setMinimumSize(dimension);
		text.setMaximumSize(dimension);
		text.setSize(dimension);
		text.setPreferredSize(dimension);
		this.add(label);
		this.add(text);
	}
	
	public JLabelJTextFieldComponent(String lable,int width, Component comp){
		this.setLayout(new FlowLayout(FlowLayout.LEFT));
		this.setOpaque(false);
		dimension=new Dimension(width, 25);
		JLabel label=new JLabel(lable,icon,JLabel.LEFT);
		text=new RPJTextField(width);
		text.setMinimumSize(dimension);
		text.setMaximumSize(dimension);
		text.setSize(dimension);
		text.setPreferredSize(dimension);
		this.add(label);
		this.add(text);
		this.add(comp);
	}
	
	public JLabelJTextFieldComponent(String lable,int width,int height){
		this.setLayout(new FlowLayout(FlowLayout.LEFT));
		this.setOpaque(false);
		dimension=new Dimension(width, height);
		JLabel label=new JLabel(lable,icon,JLabel.LEFT);
		text=new RPJTextField(width);
		text.setMinimumSize(dimension);
		text.setMaximumSize(dimension);
		text.setSize(dimension);
		text.setPreferredSize(dimension);
		this.add(label);
		this.add(text);
	}
	
	public JLabelJTextFieldComponent(String Red, String lable,int width){
		this.setLayout(new FlowLayout(FlowLayout.LEFT));
		this.setOpaque(false);
		dimension=new Dimension(width, 25);
		JLabel label = new JLabel(lable);
		JLabel red = new JLabel(Red,icon,JLabel.LEFT);
		red.setForeground(Color.red);
		text=new RPJTextField(width);
		text.setMinimumSize(dimension);
		text.setMaximumSize(dimension);
		text.setSize(dimension);
		text.setPreferredSize(dimension);
		this.add(red);
		this.add(label);
		this.add(text);
	}
	public JLabelJTextFieldComponent(String Red, String lable,String des,int width){
		this.setLayout(new FlowLayout(FlowLayout.LEFT));
		this.setOpaque(false);
		dimension=new Dimension(width, 25);
		JLabel label=new JLabel(lable);
		JLabel red = new JLabel(Red,icon,JLabel.LEFT);
		red.setForeground(Color.red);
		text=new RPJTextField(width);
		text.setMinimumSize(dimension);
		text.setMaximumSize(dimension);
		text.setSize(dimension);
		text.setPreferredSize(dimension);
		JLabel deslib=new JLabel(des);
		deslib.setFont(new Font("宋体",Font.PLAIN,12));
		this.add(red);
		this.add(label);
		this.add(text);
		this.add(deslib);
	}
	
	public JTextField getText() {
		return text;
	}
	public void setText(RPJTextField text) {
		this.text = text;
	}
}
